package com.neuedu.service.impl;

import com.github.pagehelper.PageHelper;
import com.neuedu.bean.Food;
import com.neuedu.mapper.FoodMapper;
import com.neuedu.service.FoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FoodServiceImpl implements FoodService {

    @Autowired
    private FoodMapper foodMapper ;

    @Override
    public List<Food> listFoodByBusinessId(Integer businessId) throws Exception {
        List<Food> foodList = foodMapper.listFoodByBusinessId(businessId);
        return foodList;
    }

    @Override
    public Food getFoodById(Integer foodId) throws Exception {
        return foodMapper.getFoodById(foodId);
    }

    @Override
    public List<Food> queryFoodPageList(int pageNumber, int pageSize/*, Food food*/) {
        // 必须要在查询之前，设置好分页参数
        PageHelper.startPage(pageNumber, pageSize);
        List<Food> foodList = foodMapper.queryFoodPageList();


        return foodList;
    }


}
